// Indices of data in prefs file
int n_prefs = 1;
int port_pref_idx = 0;

String pref_filename = "guiPrefs.txt";


// Tries to open prefs file & load default data
// Will set to global defaults if np prefs file
void get_prefs() {
  
  // Load Preferences file
  String pref_lines[] = loadStrings(pref_filename);
  
  // Check to see if we got data
  if (pref_lines == null) {
    
    // No - set defaults
    println("No file");
    theRocket.port_name = "Select Serial Port";
    save_prefs();
  } else {
    
    // Yes = get names and values
    //println(pref_lines[port_pref_idx]);
    theRocket.port_name = pref_lines[port_pref_idx];
  }
}

// Saves current values (in Text Boxes) as prefs file
void save_prefs() {
  String[] the_strings = new String[n_prefs];
  the_strings[port_pref_idx] = theRocket.port_name;
  saveStrings(pref_filename, the_strings);
}

